/*
 * Created on 27/02/2004
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package org.potiorb.orb.giop;

import java.io.Serializable;

public class MessageType implements Serializable {
		public static final int REQUEST = 0;
		public static final int REPLY = 1;
		public static final int CANCEL_REQUEST = 2;
		public static final int LOCATE_REQUEST = 3;
		public static final int LOCATE_REPLY = 4;
		public static final int CLOSE_CONNECTION = 5;
		public static final int MESSAGE_ERROR = 6;
		public static final MessageType Request = new MessageType(REQUEST);
		public static final MessageType Reply = new MessageType(REPLY);
		public static final MessageType CancelRequest = new MessageType(CANCEL_REQUEST);
		public static final MessageType LocateRequest = new MessageType(LOCATE_REQUEST);
		public static final MessageType LocateReply = new MessageType(LOCATE_REPLY);
		public static final MessageType CloseConnection = new MessageType(CLOSE_CONNECTION);
		public static final MessageType MessageError =	new MessageType(MESSAGE_ERROR);
		public MessageType(int V) {
			value = V;
		}
		private int value;
		public int value() {
			return value;
		}

		public static MessageType type(int v)
		{
			switch (v) {
			default:
				;
			case REQUEST:
				return MessageType.Request;

			case REPLY:
				return MessageType.Reply;

			case CANCEL_REQUEST:
				return MessageType.CancelRequest;

			case LOCATE_REQUEST:
				return MessageType.LocateRequest;

			case LOCATE_REPLY:
				return MessageType.LocateReply;

			case CLOSE_CONNECTION:
				return MessageType.CloseConnection;

			case MESSAGE_ERROR:
				return MessageType.MessageError;
			}
		}
		public String toString() {
			String[] types = {"Request",
					"Reply",
					"CancelRequest",
					"LocateRequest",
					"LocateReply",
					"CloseConnection",
					"MessageError",};
			return types[value];
		}
	}


